package com.intel.two.pojo.record.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.intel.two.pojo.record.RentingaHouseRecord;
import com.intel.two.pojo.record.recordbo.RentingaHouseRecordBo;
import com.intel.two.service.record.RentingaHouseRecordService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
@Scope("prototype")
public class RrecordListener extends AnalysisEventListener<RentingaHouseRecordBo> {
    @Autowired
    private RentingaHouseRecordService rentingaHouseRecordService;
    @Override
    public void invoke(RentingaHouseRecordBo data, AnalysisContext analysisContext) {
        RentingaHouseRecord rentingaHouseRecord = new RentingaHouseRecord();
        BeanUtils.copyProperties(data,rentingaHouseRecord);
        rentingaHouseRecordService.rentingahouseAdd(rentingaHouseRecord);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
